
#pragma once

class CHrkNodeAnim
{
public:

	CHrkNodeAnim();
	IGameNode* m_pGameNode;
	IGameControl* m_pGameCont;

	TSTR m_name;

	bool m_bFullSample;

	bool m_bHavePosAnim;
	bool m_bHaveRotAnim;
	bool m_bHaveScaleAnim;

	bool m_bBipedPosCont;
	bool m_bBipedRotCont;
	bool m_bBipedScaleCont;
	
	void CollectNodeAnim(IGameNode* pNode);

	void CollectPosAnim( IGameControl* pControl );
	void CollectScaleAnim( IGameControl* pControl );
	void CollectRotAnim( IGameControl* pControl );

	void ProcessNodeAnim( CHrkStream& os,CHrkStream& log);
	
	void ProcessPosAnim( CHrkStream& os,CHrkStream& log);
	void ProcessScaleAnim( CHrkStream& os,CHrkStream& log);
	void ProcessRotAnim( CHrkStream& os,CHrkStream& log);
	
	void ProcessNodeAffine( CHrkStream& os,CHrkStream& log);

	bool FullSampleLocalTM( Tab<GMatrix>& mtxTab );
	bool FullSampleKeys(IGameControl* pControl,IGameKeyTab &sample, int frameRate, IGameControlType Type, bool Relative = true);
	
	BOOL UnSamplePosKeys( const IGameKeyTab& sampKeys,IGameKeyTab& unSampKeys, int index); 
	BOOL UnSampleScaleKeys( const IGameKeyTab& sampKeys,IGameKeyTab& unSampKeys, int index ); 
	BOOL UnSampleRotKeys( const IGameKeyTab& sampKeys,IGameKeyTab& unSampKeys,int index  );

	BOOL HaveRotKeys( int index );
	BOOL HavePosKeys( int index );
	BOOL HaveScaleKeys( int index );

	BOOL HaveKeys();
	
	IGameKeyTab m_posKeys[3];
	BOOL m_bHavePosKeys[3];
	BOOL m_bLinearPos;
	BOOL m_bForceSample;
	
	IGameKeyTab m_rotKeys[3];
	BOOL m_bHaveRotKeys[3];
	BOOL m_bLinearRot;

	IGameKeyTab m_scaleKeys[3];
	BOOL m_bHaveScaleKeys[3];
	BOOL m_bLinearScale;

	std::vector<AngAxis> m_angAxisTab;
	std::vector<Quat> m_quatTab;

	int m_FrameCount;
	Tab<GMatrix> m_mtxTab;
	Tab<AffineParts>m_apTab;

	int m_tpf;
	TimeValue m_start;
};